fix: show ips on instance get and list#37
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughVM API models now include IP address and offering data, with helpers deriving display values. Instance list/get commands use those helpers and offering billing-cycle data, while service response tests cover empty lists and not-found errors. ChangesVM output data
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
pkg/api/instance/instance.go (1)
180-185: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider renaming
IPAddressesstruct toIPAddress(singular).The struct represents a single IP address entry, but the plural name
IPAddressesmakes the slice field[]IPAddressesread as "a slice of IPAddresses" (redundant plural). Renaming toIPAddresswould make[]IPAddressclearer.♻️ Optional naming refactor
-type IPAddresses struct { +type IPAddress struct { ID string `json:"id"` IPAddress string `json:"ipaddress"` Type string `json:"type"` }And update the field type:
- IPAddresses []IPAddresses `json:"ipaddresses"` + IPAddresses []IPAddress `json:"ipaddresses"`🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/api/instance/instance.go` around lines 180 - 185, Rename the IPAddresses struct to IPAddress and update all references, including slice fields such as []IPAddresses, to use []IPAddress for consistent singular element naming.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/commands/instance.go`:
- Around line 205-208: Guard the billing cycle access in the billing cycle
initialization by checking both vm.Offering and vm.Offering.BillingCycle for nil
before reading Name, preserving the previous nil-safe behavior.
- Around line 219-220: Rename the variable `pubicIP` to `publicIP` and update
all references, including the usage near line 230.
In `@pkg/api/instance/instance.go`:
- Around line 128-146: Update the instance retrieval path used by Service.Get to
append the query parameter include=networks,ipaddresses when requesting the
virtual machine by slug. Locate the relevant Service.Get method and ensure its
API request asks for expanded network and IP address data required by
VirtualMachine.GetPublicIPAddress.
---
Nitpick comments:
In `@pkg/api/instance/instance.go`:
- Around line 180-185: Rename the IPAddresses struct to IPAddress and update all
references, including slice fields such as []IPAddresses, to use []IPAddress for
consistent singular element naming.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 50ef0757-18a6-4e6e-b10b-948e97a31e56
📒 Files selected for processing (3)
internal/commands/instance.gopkg/api/instance/instance.gopkg/api/instance/instance_test.go
Adresses #36
-instead of leaving it blank when the instance doesn't have an ip or isn't assigned one, this personally improves the readability, but this can be reverted if its the standardScreen.Recording.2026-07-10.at.11.32.05.mov
Summary by CodeRabbit
Bug Fixes
Tests